# Maintainer: Sébastien Luttringer
# Maintainer: Thore Bödecker <foxxx0@archlinux.org>
# Contributor: Kaiting Chen <kaitocracy@gmail.com>
# Contributor: Mark Smith <markzzzsmith@yahoo.com.au>

pkgname=radvd
pkgver=2.19
pkgrel=1
pkgdesc='IPv6 Router Advertisement Daemon'
url='http://www.litech.org/radvd/'
license=('custom')
depends=('glibc')
makedepends=('check')
arch=('loong64' 'x86_64')
backup=('etc/radvd.conf')
# for unknown reasons upstream has stopped signing the tarballs since version 2.19
validpgpkeys=(
  '10E2511038172B516DCA5BD36FE19F21451C9A2B' # Reuben Hawkins
  '7D0B3CEBE9B85B1F825BCECFEE05E6F6A48F6136' # Robin Hugh Johnson
)
source=("http://www.litech.org/radvd/dist/${pkgname}-${pkgver}.tar.xz"{,.asc}
        "${pkgname}.service")
sha512sums=('a1eb40af90fc83ebab2517c16a0f7e85c11338ab276bec400b7c33177748d1e36bc5abd7e373b6742f12f7c690dd7ae6b951bc832c7de9bbb56f7e9bc844ed22'
            'SKIP'
            'f8abe3e0233c33313e768c45b2873bfc70b6461337c57ae6e07196d3e9d23338fdec56b1c92d3fa1a2a691f83fd850588095352570ce3d2c0cc32ac07862f426')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  :
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  ./configure \
    --prefix=/usr \
    --sbindir=/usr/bin \
    --sysconfdir=/etc \
    --with-pidfile=/run/radvd.pid \
    --with-check \
    --mandir=/usr/share/man
  make
}

check() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make check
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
  # default config
  install -D -m 644 radvd.conf.example "${pkgdir}/etc/radvd.conf"
  # license
  install -D -m 644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/COPYRIGHT"
  # systemd
  install -D -m 644 "${srcdir}/${pkgname}.service" \
    "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
}

# vim:set ts=2 sw=2 et:
